<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@include file="../base.jsp"%> 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>客户查询</title>    
<link href="../css/main.css" rel="stylesheet" type="text/css" >
<link rel="stylesheet" type="text/css" href="../../js/jquery/easyui1.5/themes/bootstrap/easyui.css">
<link rel="stylesheet" type="text/css" href="../../js/jquery/easyui1.5/themes/icon.css">
<script type="text/javascript" src="../../js/jquery-1.8.0.min.js"></script>
<script src="../../js/jquery/easyui1.5/jquery.easyui.min.js"></script>
<script src="../../js/jquery/easyui1.5/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../../js/jquery.select.js"></script>
 
<script type="text/javascript">
var datagrid={
    datagridId:"customerList",
    datagridUrl:"userAjax_queryCustomerListBySearch.action",
    datagridObj:{
        /*title:"查询列表",*/
        nowrap:true,
        autoRowHeight:false,
        fit:true,
        columns:[
            [
                {field:'email',title:'邮箱'},
                {field:'phoneNo',title:'手机'},
                {field:'enabledStr',title:'状态'},
                {field:'createTimeStr',title:'录入时间'},
                {field:'loginTimes',title:'登录次数'},
                {field:'loginTimeLastStr',title:'最后一次登录时间'},
                {field:'hasIdentificationStr',title:'是否实名'},
                {field:'name',title:'姓名'},
                {field:'sexStr',title:'性别'},
                {field:'idCardType',title:'证件类型'},
                {field:'idCardNo',title:'证件号码'},
                {field:'balanceCash',title:'现金帐户余额'},
                {field:'balance3thCard',title:'预卡帐户余额'},
                {field:'moneyFrozen',title:'冻结金额'},
                {field:'accountStatusStr',title:'帐户状态'},
                {field:'listStatusStr',title:'名单状态标志'},
                {field:'lastTradeDateStr',title:'最后交易日期'},
                {field:'remark',title:'备注'}
            ]
        ],
        rownumbers:true,
		frozenColumns:[[
						{field:'accountId',title:'账户ID'}
					]]
    },
    datagridProperty:{
    	loginName:'用户名',
    	enabled:'状态',
    	recordDateStart:'创建日期(起)',
    	recordDateEnd:'创建日期(止)'
    },
    datagridPropertySort:{
    	accountId:'默认属性',
    	createDate:'创建日期'
    },
    datagridPropertyMultiQuery:{
    	enabled:'状态'
    }
}

function approval(){
    var rows = $('#customerList').datagrid('getSelections');
    if(rows.length!=1){
        alert('请选择一项(只能选择一项)进行操作');
        return false;
    }
    var loginName = rows[0].loginName;
    if(confirm("确认审核通过选中客户吗?")){
    	$.ajax({
    		type:"POST",
    		url:"customerAjax_approval.action",
    		dataType:"json",
    		data:{'loginName':loginName},
    		success:function(msg){
    			var msg = eval("("+msg+")"); 
				alert(msg.responseContent+",刷新页面查看最新结果");
    			return;
    		},
    		error:function(er){
    			alert('系统出错');
    		}
    	  })
    }
}

function disable(){
    var rows = $('#customerList').datagrid('getSelections');
    if(rows.length!=1){
        alert('请选择一项(只能选择一项)进行操作');
        return false;
    }
    var loginName = rows[0].loginName;
    if(confirm("确认失效选中客户吗?")){
        $.ajax({
			type:"POST",
			url:"customerAjax_disable.action",
			dataType:"json",
			data:{'loginName':loginName},
			success:function(msg){
				var msg = eval("("+msg+")"); 
				alert(msg.responseContent+",刷新页面查看最新结果");
				return;
			},
			error:function(er){
				alert('系统出错');
			}
		  })
    }
}

function resetPassword(){
    var rows = $('#customerList').datagrid('getSelections');
    if(rows.length==0){
        alert('请选择一项');
        return false;
    }
    for(var i=0;i<rows.length;i++){
        var loginName = rows[i].loginName;
        window.parent.Open('重置密码[用户名:'+loginName+']','user/resetPassword.jsp?loginName='+loginName); 
    }
}
</script>
<style type="text/css">
	.west{
		width: 200px;
		padding: 3px;
	}
	.north{
		height:70px;
		padding:3px;
	}
	.center{
		padding: 3px;
	}
</style>
</head>

    
<s:select 
    id="enabledTmp"
    cssStyle="display: none;"
    list="#{1:'有效',0:'无效',-1:'注销'}" 
    listKey="key" 
    listValue="value"/>
    
    
<body class="easyui-layout" style="margin: 2px;">
	<div region="north" class="north" >
        <jsp:include page="../conditionNorth.jsp"></jsp:include>
	</div>
	<div region="center" class="center" >
         <table id="customerList" width="100%" ></table>
	</div>
</body>

</html>